package site.assad.aspectj.example;

import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;

/**
 * Author: Al-assad 余林颖
 * E-mail: yulinying_1994@outlook.com
 * Date: 2017/12/5 19:22
 * Description: @AfterReturning 后置增强切面类，增强 Waiter 子类的 greetTo 方法；
 *
 */
@Aspect
public class AfterGreetingAspect {
    @AfterReturning(value = "execution( * greetTo(..)) && target(site.assad.common.Waiter)",
                    returning = "retVal")   //绑定返回值
    public void afterGreeting(Object retVal){
        System.out.println("Goodbye!");
        if(retVal != null){
            System.out.println(retVal);
        }
    }
}
